package com.umeng.soexample.mvc.control;

import android.content.Context;
import android.content.SharedPreferences;

public class SPHelperSave {
    private Context context;
    private static SPHelperSave instence = new SPHelperSave();
    private SharedPreferences sp;
    private SharedPreferences address_default;
    private SPHelperSave(){}

    public static SPHelperSave getInstance(){
        return instence;
    }

    public void init(Context context){
        this.context = context;
        sp = context.getSharedPreferences("helper", Context.MODE_PRIVATE);
        address_default = context.getSharedPreferences("address_default", Context.MODE_PRIVATE);
    }

    /**
     * 获取引导页是否已经登录过
     */
    public boolean isLogin(){
        return sp.getBoolean("isLogin", false);
    }

    /**
     * 添加引导页是否进入过
     */
    public void setLogin(boolean isLogin){
        sp.edit().putBoolean("isLogin", isLogin).commit();
    }

    /**
     * 添加默认地址id
     */
    public void setAddress_default(String address_id){
        address_default.edit().putString("address_default", address_id).commit();
    }
    /**
     * 获取默认地址id
     */
    public String getAddress_default(){
        return address_default.getString("address_default", "");
    }

}
